<?php

namespace addons\cusaddress;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Cusaddress extends Addons
{

    /**
     * 插件安装方法（只需要安装用户表即可）
     * @return bool
     */
    public function install()
    {
        $menu = [
            [
                'name'   => 'cusaddress',
                'title'  => '地址管理',
                'ismenu' => 1,
                'icon'   => 'fa fa-list',
                'remark' => '小程序地址管理',
                'sublist' => [
                    ['name' => 'cusaddress/index', 'title' => '查看'],
                    ['name' => 'cusaddress/add', 'title' => '添加'],
                    ['name' => 'cusaddress/edit', 'title' => '编辑 '],
                    ['name' => 'cusaddress/del', 'title' => '删除'],
                    ['name' => 'cusaddress/multi', 'title' => '批量更新'],
                ]
            ]
        ];
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('cusaddress');
        return true;
    }

    /**
     * 插件启用方法
     */
    public function enable()
    {
        Menu::enable('cusaddress');
        return true;
    }

    /**
     * 插件禁用方法
     */
    public function disable()
    {
        Menu::disable('cusaddress');
        return true;
    }

}
